Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
About the Active Frame Border
The display of the active frame border is managed by OpenDoc. Neither the active part nor its containing part need to display the active border; OpenDoc itself does that. All the active part needs to do to get the active border is to acquire the Selection focus, and relinquishing the focus will remove the border.
Even though the containing part doesn’t have to display the active border of an embedded frame, it does have to deal with the border to some extent. There are two things the containing part must do:
• Adjust the active border’s shape. This amounts to clipping the shape where it is obscured by intrinsic content or embedded frames in the containing part.
• Ensure that the active border is not overwritten by intrinsic content or embedded parts it obscures. This requires that the containing part clip the active border shape from the obscured parts. See the Clipping Embedded Facets recipe for information on how to do that.
Adjusting the Border Shape
When an embedded frame acquires the selection focus, or a frame that already has the focus has its FrameShape changed, OpenDoc will calculate a new active border shape, and then ask the frame’s containing part to adjust it. OpenDoc will call AdjustBorderShape() on the containing part, passing the shape to be adjusted, and the facet it is associated with.
Adjusting the active border shape is a straightforward process. Just clip out all the portions that are obscured by the containing part’s intrinsic content or embedded frames. Do not clip the shape to the containing part’s clip shape; OpenDoc will do that.
About Reference Counts
The AdjustBorderShape() method is considered a source for the returned shape. It may be creating a new shape, which will have to be released later. For that reason, if all your part does is return the shape parameter, it must make sure to inflate the reference count first. Remember the, shape param may be released by the calling code after the method exits, so you can't rely on that reference to keep the shape alive.
Clipping Obscured Content and Parts
After the containing part has adjusted the active border shape, it should store the adjusted shape in a variable or field. When the stored shape is non-null, the part should make sure that intrinsic content or embedded frames are clipped so they do not overwrite the active border.
When the active border is moved to a different frame, OpenDoc will notify the containing part by calling AdjustBorderShape with a value of kODNULL for the shape. The containing part can then un-clip obscured content and embedded frames. If the containing part receives several AdjustBorderShape calls in a row that all have non-null shapes, it should use the union of all those shapes for clipping its content and embedded frames. This is because there may be more than one facet on the active frame embedded in the same containing part.
Sample Code
Note that this sample code does not deal with intrinsic content, but only with embedded parts. See the Clipping Embedded Facets recipe for an example of how to generalize this code to deal with intrinsic content.